//@ts-nocheck
import { defineStore } from "pinia";

export const useLocalStore = defineStore("plan_localStore", {
  state: () => {
    return {
      jsonLine: "",
      selectedFeatureIdList: [],
      selectedFeature: null,
      visibleLineClassIds: null,
      visiblePointClassIds: null,
      visibleAreaTypes: [0, 1, 2],
    };
  },
  actions: {
    setJsonLine(jsonLine) {
      this.jsonLine = jsonLine;
    },
    setSelectedFeatureIdList(idList: Array<number | string>) {
      this.selectedFeatureIdList = idList;
    },
    addSelectedFeatureId(id: number | string) {
      this.selectedFeatureIdList = [id, ...this.selectedFeatureIdList];
    },
    setSelectedFeature(feature) {
      this.selectedFeature = feature;
    },
    setVisibleLineClassIds(ids: Array<string>) {
      this.visibleLineClassIds = ids;
    },
    setVisiblePointClassIds(ids: Array<string>) {
      this.visiblePointClassIds = ids;
    },
    setVisibleAreaTypes(flag: boolean) {
      this.visibleAreaTypes = flag;
    },
    resetVisibleLayerState() {
      this.visibleLineClassIds = null;
      this.visiblePointClassIds = null;
      this.visibleAreaTypes = [0, 1, 2];
    },
  },
});
